import { GameActionQueueEnum, GameManager } from "../../scripts/GameManager";
import { PalBattleSkillOriginData, PalBattleSystem } from "../../scripts/PalBattleSystem";
import { SkillEnum } from "./SkillEnum";

export const skill_002_五气朝元: PalBattleSkillOriginData = {
    skillID: SkillEnum.五气朝元,
    name: '五气朝元',
    mpCost: 10,
    order: () => 20,
    needTarget: false,
    targets: (args: { system: PalBattleSystem }) =>
        args.system.heros.filter((hero) => !hero.saveData.dead).map((hero) => hero.saveData.UUID),
    callable: (args: { game: GameManager; system: PalBattleSystem; targets: string[] }) => {
        const system = args.system;
        const actions = [
            {
                action: GameActionQueueEnum.HeroAnime,
                duration: 1,
                args: {
                    UUID: args.targets[0],
                    name: 'heal',
                }
            },
        ];
        args.targets.forEach(iter => {
            actions.push({
                action: GameActionQueueEnum.SetHeroStatus,
                duration: 0,
                args: {
                    UUID: iter,
                    // @ts-ignore
                    status: 'hp',
                    value: system.getHealHero(iter, 50),
                }
            })
        })
        system.actionQueue.add({
            actions: actions,
            flag: 'heal_五气朝元'
        });
    }
}


